package com.produce.user.controller;

import com.common.dao.base.controller.BaseController;
import com.common.dao.base.service.BaseService;
import com.produce.user.entity.UserRole;
import com.produce.user.service.RoleTreeService;
import com.produce.user.service.UserRoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * 类描述：角色的controller
 *
 * @author linzf
 */
@RestController
@RequestMapping(value = "/role")
public class RoleController extends BaseController<UserRole> {

    @Autowired
    private UserRoleService userRoleService;

    @Autowired
    private RoleTreeService roleTreeService;

    @Override
    protected BaseService<UserRole> getService() {
        return this.userRoleService;
    }

    @PostMapping("getAllTreeAndButtonList")
    public Map<String, Object> getAllTreeAndButtonList() {
        return roleTreeService.getAllTreeList(false);
    }
}
